package com.diandi.ddsb.bean;

/**
 * 
 * 邀请活动奖励节点
 * 
 * @author liuxu
 * @since 2016年5月24日
 *
 */
public enum InviteNodeType {
	REGISTER(1, "注册"), AUTHENTICATION(2, "实名认证"), BINDCARD(3, "绑卡"), RECHARGE(4, "充值"), FIRST_INVEST(5, "首投")
	, MIAOJIE(97, "秒借邀请")
	, MIAOJIE_INVEST(98, "秒借邀请"), FIRST_MIAOJIE(99, "秒借邀请");

	/**
	 * value
	 */
	private final String text;
	/**
	 * key
	 */
	private final int value;

	InviteNodeType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public static InviteNodeType getTextByValue(int value) {
		for (InviteNodeType item : InviteNodeType.values()) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new RuntimeException(value + "不是合法的类型！");
	}

	public static InviteNodeType getValueByText(String text) {
		for (InviteNodeType item : InviteNodeType.values()) {
			if (item.getText() == text) {
				return item;
			}
		}
		throw new RuntimeException(text + "不是合法的类型！");
	}

	public String getText() {
		return text;
	}

	public int getValue() {
		return value;
	}
}
